package com.aaa.system.controller.api;

import com.aaa.entity.CheckItem;
import com.aaa.entity.RegisteredItem;
import com.aaa.system.aop.annotation.Log;
import com.aaa.system.service.ICheckItemService;
import com.aaa.system.service.IRegisteredItemService;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 响应到前端的controller类
 */
@RestController
@RequestMapping("system/api/regItem")
public class ApiRegItemController {

    @Autowired
    private IRegisteredItemService registeredItemService;

    /**
     * 分页动态查询所有挂号费用设置
     * @param current  当前页码
     * @param size  每页显示条数
     * @param registeredItem 挂号费用查询条件对象
     * @return  分页结果
     */
    @PostMapping("selectAll/{current}/{size}")
    public Result<IPage<RegisteredItem>> selectAll(
            @PathVariable Integer current,
            @PathVariable Integer size,
            @RequestBody RegisteredItem registeredItem
    ){
        Result<IPage<RegisteredItem>> selectAll = registeredItemService.selectAll(current,size,registeredItem);
        return selectAll;
    }

    /**
     * 添加、修改挂号费用设置
     * @param registeredItem 挂号费用设置对象
     * @return 操作结果信息
     */
    @Log(title = "添加/修改挂号费用",business_type = "1")
    @PostMapping("saveOrUpdateRegItem")
    public Result<Boolean> saveOrUpdateRegItem(@RequestBody RegisteredItem registeredItem){
        return registeredItemService.saveOrUpdateRegItem(registeredItem);
    }

    /**
     * 根据挂号费用id删除单个或者多个挂号费用设置
     * @param regItemIds 挂号费用设置id数组
     * @return  操作结果信息
     */
    @Log(title = "删除挂号费用",business_type = "3")
    @DeleteMapping("deleteRegItemByIds/{regItemIds}")
    public Result<Boolean> deleteRegItemByIds(@PathVariable Long[] regItemIds){
        return registeredItemService.deleteRegItemByIds(regItemIds);
    }


}
